<template>
	<view class="content">
		<z-paging ref="paging" v-model="data.dataList" @query="queryList">
			<template #top>
				<view class="search-box" style="">
					<u-search placeholder="搜索合同名称" v-model="keyword" shape="square" :showAction="false" height="80rpx"
						placeholderColor="rgba(0,0,0,0.4)" @search="search" @clear="clear"></u-search>
				</view>
			</template>
			<view class="contract-list flex" @click="itemClick(item)" v-for="(item,index) in data.dataList"
				:key="index">
				<image class="file-icon" src="../../../static/images/file-paste_normal.png"></image>
				<view class="title_box">
					<text class="title">{{ item.contract_tpl_title }}</text>
				</view>
				<view class="use"> 使用 </view>
			</view>
		</z-paging>
	</view>
</template>
<script setup>
	import {
		memberTemplateList
	} from "../../../api/module/contract.js"
	import {
		onLoad,
		onShow
	} from "@dcloudio/uni-app";
	import {
		ref,
		reactive
	} from 'vue';
	import {
		useStore
	} from 'vuex';
	import {
		goNav
	} from "../../../utils/common";
	const data = reactive({
		dataList: [],
	})
	const keyword = ref('')
	const store = useStore()
	const paging = ref(null)
	const keyWord = ref('')
	const queryList = (pageNo, pageSize) => {
		let params = {
			page: pageNo,
			limit: pageSize,
			name: keyword.value
		}
		memberTemplateList(params).then(res => {
			paging.value.complete(res.data)
		})
	}
	const clear = () => {
		keyword.value = ''
		paging.value.reload();
	}
	const search = () => {
		paging.value.reload();
	}
	const itemClick = (item) => {
		let url = '/pages/contract/person/initiate?id=' + item.contract_tpl_id
		goNav(url);
	}
	onShow(() => {
		paging.value.reload();
	})
</script>
<style lang="scss" scoped src="/static/css/contract/templateList.scss"></style>